<!--  -->
<template>

  <div class="customer-label" v-if="tags">
    <template v-if="tags.length !== 0">
      <div class="customer-label-list flex tag-height" >
        <block v-for="(item, index) in tags" :key="index">
          <div class="label-item flex-a-c flex-j-c">
            <span>{{ item.name }}</span>
            <div class="tag-clone" @click.stop="deleteTag(item.tag_id)" v-show="delShow">x</div>
          </div>
        </block>
      </div>
      <span v-show="labeLMore" @click="tagsMoreOn" class="view-more ">
        查看全部<span class="iconfont icon-course_goon" :class="[labeLClass?'overturn':'']"></span>
      </span>
    </template>
    <template v-else>
      <div>暂无标签</div>
    </template>
  </div>
</template>

<script>
  //这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
  //例如：import 《组件名称》 from '《组件路径》';

  export default {
  name:'',
  props:{
    tags:{
      type:Array,
      default() {
        return []
      }
    },
    labeLMore:Boolean,
    labelShow:Boolean,
    labeLClass:Boolean,
    delShow:Boolean
  },
  //import引入的组件需要注入到对象中才能使用
  components: {},
  computed: {
  },
  data() {
  return {
    
  };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    tagsMoreOn() {
      // this.labeLClass = !this.labeLClass;
      this.$emit('update:labelShow', true);
    },
    deleteTag(id) {
      this.$emit('deleteTag',{tagId:id})
    }
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {

  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {

  },
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang="scss" scoped>
/* @import url(); 引入公共css类 */
.customer-label {
  position: relative;
  // padding:0 0 0.625rem 0;
  background: #FFFFFF;
  border-radius: 6px 6px 6px 6px;
  padding:10px;
  margin: 0 10px;
  .customer-label-list {
    height: auto;
    // margin: 0.75rem 0 0 0;
    padding-bottom: 0.4375rem;
    flex-wrap: wrap;
    position: relative;
    .label-item {
      font-size: 12px;
      line-height: 12px;
      padding:6px 10px;
      color: #3B3B4A;
      margin:0 10px 10px 0;
      position: relative;
      display: inline-block;
      background: #F5F5F5;
      border-radius: 6px 6px 6px 6px;
      // text-align: center;
      // min-width: 3.75rem;
      // box-sizing: border-box;
      // border: 0.0625rem solid #f78b00;
      // border-radius: 0.125rem;
      // font-size: 0.6875rem;
      // line-height: 0.6875rem;
      // color: #f78b00;
      // padding: 0.3125rem 0.4375rem 0.3125rem 0.4375rem;
      // margin: 0 0.4375rem 0.625rem 0;

      &:nth-child(5) {
        margin: 0 0 0.625rem 0;
      }
      .tag-clone {
        background: rgba(0, 0, 0, 0.5);
        border-radius: 0px 6px 0px 6px;
        color:#fff;
        font-weight: bold;
        font-size: 11px;
        line-height: 11px;
        position: absolute;
        right:0;
        top:0;
        z-index: 3;
        padding:3px 4px;
        cursor: pointer;
      }
    }
  }
  .view-more {
    width:100%;
    font-size: 13px;
    line-height: 13px;
    color: #3B3B4A;
    cursor: pointer;
    padding:15px 0;
    // margin:5px 0 0 0;
    text-align: center;
    .icon-course_goon {
      font-size: 13px;
      display: inline-block;
      transform: rotate(0deg);
      transition: 0.5s;
      color:#AAAAB3;
      
    }
    .overturn {
      transform: rotate(90deg);
      transition: 0.5s;
    }
  }
  .tag-height {
    height: 136px;
    // transform: translateY(0%);
    overflow: hidden;
    transition:height 0.5s;
  }
  .tag-more {
    height: auto;
    overflow: hidden;
    transition:height 0.5s;
  }
}
</style>